﻿<%@ Page Title="" Language="C#" MasterPageFile="~/shop/MasterPage.master" AutoEventWireup="true" CodeFile="Purchase.aspx.cs" Inherits="admin_Purchase" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .auto-style5 {
            text-align: center;
        }
        .auto-style7 {
            margin-left: 6px;
        }
        .auto-style8 {
            width: 100%;
        }
        .auto-style9 {
            width: 124px;
        }
        .auto-style11 {
            width: 367px;
        }
        .auto-style6 {
            margin-left: 95px;
        }
        .auto-style12 {
            height: 24px;
        }
        </style>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="auto-style8">
        <tr>
            <td class="auto-style9">
    <asp:Label ID="Label1" runat="server" Text="商品编号"></asp:Label>
            </td>
            <td class="auto-style11">
    <asp:TextBox ID="TextBox1" runat="server" Width="72px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="输入不能为空！" ForeColor="#FF3300"></asp:RequiredFieldValidator>
            </td>
            <td>
    <asp:Label ID="Label6" runat="server" Text="商品类型："></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="auto-style9">
    <asp:Label ID="Label2" runat="server" Text="商品名称"></asp:Label>
            </td>
            <td class="auto-style11">
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="输入不能为空！" ForeColor="#FF3300"></asp:RequiredFieldValidator>
            </td>
            <td rowspan="4">
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" CssClass="auto-style6" Width="157px">
        <asp:ListItem Value="A">洗漱日化（A）</asp:ListItem>
        <asp:ListItem Value="B">生鲜水果（B）</asp:ListItem>
        <asp:ListItem Value="C">休闲零食（C）</asp:ListItem>
        <asp:ListItem Value="D">酒水调料（D）</asp:ListItem>
        <asp:ListItem Value="E">冷冻食品（E）</asp:ListItem>
    </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td class="auto-style9">
    <asp:Label ID="Label3" runat="server" Text="数       量"></asp:Label>
            </td>
            <td class="auto-style11">
    <asp:TextBox ID="TextBox3" runat="server" Width="44px"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox3" ErrorMessage="数量应大于0！" ForeColor="#FF3300" MaximumValue="1000" MinimumValue="1" Type="Integer"></asp:RangeValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3" ErrorMessage="输入不能为空！" ForeColor="#FF3300"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="auto-style9">
    <asp:Label ID="Label5" runat="server" Text="价  格"></asp:Label>
            </td>
            <td class="auto-style11">
    <asp:TextBox ID="TextBox4" runat="server" Width="47px"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="TextBox4" ErrorMessage="价格应大于0！" ForeColor="#FF3300" MaximumValue="10000" MinimumValue="0.01" Type="Double"></asp:RangeValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox4" ErrorMessage="输入不能为空！" ForeColor="#FF3300"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="auto-style9">
    <asp:Label ID="Label4" runat="server" Text="图  片"></asp:Label>
            </td>
            <td class="auto-style11">
    <asp:FileUpload ID="FileUpload1" runat="server" Width="255px" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:Label ID="zhushi" runat="server" ForeColor="#FF3300" Text="提示！"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="3">
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="添加" CssClass="auto-style7" Height="30px" Width="97px" />
            </td>
        </tr>
        <tr>
            <td colspan="3" class="auto-style12">
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:keshe2ConnectionString %>" DeleteCommand="DELETE FROM 商品 WHERE (商品编号 = @商品编号)" ProviderName="<%$ ConnectionStrings:keshe2ConnectionString.ProviderName %>" SelectCommand="SELECT 商品编号, 商品名称, 数量, 图片, 价格, 商品类型 FROM 商品">
                    <DeleteParameters>
                        <asp:ControlParameter ControlID="GridView1" Name="商品编号" PropertyName="SelectedValue" />
                    </DeleteParameters>
                </asp:SqlDataSource>
                <br />
                <asp:Label ID="Label7" runat="server" Text="查询类别"></asp:Label>
                <asp:DropDownList ID="DropDownList1" runat="server" Height="30px" Width="135px">
                    <asp:ListItem Value="商品编号">商品编号</asp:ListItem>
                    <asp:ListItem Value="商品名称">商品名称</asp:ListItem>
                    <asp:ListItem Value="数量">数量</asp:ListItem>
                    <asp:ListItem Value="价格">价格</asp:ListItem>
                </asp:DropDownList>
                <asp:TextBox ID="txtValue" runat="server" Height="21px" Width="196px"></asp:TextBox>
                <asp:Button ID="btnValue" runat="server" CausesValidation="False" Height="30px" OnClick="btnValue_Click" Text="查询" Width="91px" />
&nbsp;
                <asp:Button ID="Button2" runat="server" CausesValidation="False" Height="30px" OnClick="Button2_Click" Text="返回" Width="82px" />
            </td>
        </tr>
    </table>
    <br />
    <div class="auto-style5">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="商品编号" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="300px" Width="996px" AllowPaging="True" PageSize="5">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="商品编号" HeaderText="商品编号" ReadOnly="True" SortExpression="商品编号" />
            <asp:BoundField DataField="商品名称" HeaderText="商品名称" SortExpression="商品名称" ReadOnly="True" />
            <asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" />
            <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" ReadOnly="True" />
            <asp:BoundField DataField="名称" HeaderText="商品类型" SortExpression="名称" ReadOnly="True" />
            <asp:ImageField DataImageUrlField="图片" HeaderText="商品图片" ReadOnly="True">
                <ControlStyle Height="120px" Width="120px" />
                <ItemStyle Width="100px" />
            </asp:ImageField>
            <asp:BoundField DataField="图片" HeaderText="图片" SortExpression="图片" ReadOnly="True" Visible="False" />
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    </div>
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:keshe2ConnectionString %>" DeleteCommand="DELETE FROM [商品] WHERE [商品编号] = @original_商品编号 AND [商品名称] = @original_商品名称 AND [数量] = @original_数量 AND (([图片] = @original_图片) OR ([图片] IS NULL AND @original_图片 IS NULL)) AND [价格] = @original_价格 AND [商品类型] = @original_商品类型" InsertCommand="INSERT INTO [商品] ([商品编号], [商品名称], [数量], [图片], [价格], [商品类型]) VALUES (@商品编号, @商品名称, @数量, @图片, @价格, @商品类型)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT 商品.商品编号,商品.商品名称,商品.数量,商品.图片,商品.价格,商品类型.名称 FROM 商品,商品类型 WHERE 商品.商品类型=商品类型.编号" UpdateCommand="UPDATE 商品 SET 数量 = @数量  WHERE [商品编号] = @original_商品编号 ">
        <DeleteParameters>
            <asp:Parameter Name="original_商品编号" Type="String" />
            <asp:Parameter Name="original_商品名称" Type="String" />
            <asp:Parameter Name="original_数量" Type="Int32" />
            <asp:Parameter Name="original_图片" Type="String" />
            <asp:Parameter Name="original_价格" Type="Double" />
            <asp:Parameter Name="original_商品类型" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="商品编号" Type="String" />
            <asp:Parameter Name="商品名称" Type="String" />
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="图片" Type="String" />
            <asp:Parameter Name="价格" Type="Double" />
            <asp:Parameter Name="商品类型" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="original_商品编号" />
        </UpdateParameters>
    </asp:SqlDataSource>
&nbsp;<br />
&nbsp;<br />
&nbsp;&nbsp;
    <br />
&nbsp;&nbsp;
    <br />
&nbsp;&nbsp;
    <br />
&nbsp;<br />
</asp:Content>

